﻿<%@ Control Language="C#" Inherits="Yuanlin.Business.ProductEditControl, Yuanlin.Business" AutoEventWireup="true" %>

<script type="text/javascript">
<!--
    function CheckValue()
    {
        var title = getObject('<%= titleValuedTextBox.ClientID %>');
        if(title.value.length == 0)
        {
            alert('请填写常用名！');
            title.focus();
            return false;
        }
        else if(len(title.value) > 5)
        {
            alert('常用名最多只能输入5个字！');
            title.focus();
            return false;
        }
        else if (getObject('<%= categoryValuedDropDownList.ClientID %>').selectedIndex <= 0)
        {
            alert('请选择植物分类！');
            getObject('<%= categoryValuedDropDownList.ClientID %>').focus();
            return false;
        }
        
        var appchked=false;  
        var appcheckobj = document.getElementById('<%= applicationCategoryCheckBoxList.ClientID %>'); 
        var appchecks = appcheckobj.getElementsByTagName("input"); 
        var iappchecked = 0;
        for(var n=0;n <appchecks.length;n++) 
        { 
            if(appchecks[n].type== "checkbox" && appchecks[n].checked==true) 
            { 
               appchked=true; 
               iappchecked=iappchecked+1;
            } 
        } 
        if(!appchked)
        {
            alert('至少选择1个应用分类！');
            return false;
        }
        else if (iappchecked>5)
        {
            alert('最多选择5个应用分类！');
            return false;
        }

        return true;
    }
    //-->
</script>

<div class="AdminArea">
    <fieldset>
        <legend><nwap:ResourceLiteral runat="server" ResourceName="System_Applications_Yuanlin_EditProduct" ResourceFile="ControlPanelResources.xml"></nwap:ResourceLiteral></legend>
        
        <div class="ThubnailImage">
			<nwap:YuanlinImage ID="productImage" runat="server" UseRealSize="true" ImageType="Details" Width="240" Height="157" PictureLink="true" DefaultFileName="defaultSiteSmallPic.gif" AttachmentName="Product"/>
        </div>
        
        <div class="FormRow">
            <div class="LargerFieldNameRequireCharacter">
                <nwap:ResourceLabel runat="Server" CssClass="RedColor" ResourceFile="ControlPanelResources.xml" ResourceName="RequireCharacter" />
                <nwap:ResourceLabel runat="Server" ResourceFile="ControlPanelResources.xml" ResourceName="System_Applications_Yuanlin_Product_Title" />
            </div>
            <nwap:ValuedTextBox Runat="server" CssClass="InputField MiddleWidth" id="titleValuedTextBox" Enabled="false"/>&nbsp;&nbsp;&nbsp;&nbsp;
        </div>
        <div class="FormRow">
            <nwap:ResourceLabel CssClass="FieldName" runat="Server" ResourceFile="ControlPanelResources.xml" ResourceName="System_Applications_Yuanlin_Product_Alias" />
            <nwap:ValuedTextBox Runat="server" CssClass="InputField MiddleWidth" id="aliasValuedTextBox" />
        </div>
        <div class="FormRow">
            <h4 class="RedColor">
                <nwap:ResourceLabel CssClass="FieldName" runat="Server" ResourceFile="ControlPanelResources.xml" ResourceName="" />
                <nwap:ResourceLabel CssClass="MiddleWidth" runat="Server" ResourceFile="ControlPanelResources.xml" ResourceName="System_Applications_Yuanlin_Product_Tip" />
            </h4>
        </div>
        <div class="FormRow">
            <nwap:ResourceLabel CssClass="FieldName" runat="Server" ControlToLabel="attachmentData" ResourceFile="ControlPanelResources.xml" ResourceName="System_Applications_Yuanlin_Product_Picture" />
            <asp:FileUpload onchange="CheckImage(this)" Runat="server" CssClass="InputField MiddleWidth" id="attachmentData" />
        </div>
        <div class="FormRow">
             <div class="LargerFieldNameRequireCharacter">
                <nwap:ResourceLabel runat="Server" CssClass="RedColor" ResourceFile="ControlPanelResources.xml" ResourceName="RequireCharacter" />
                <nwap:ResourceLabel runat="Server" ResourceFile="ControlPanelResources.xml" ResourceName="System_Applications_Yuanlin_Product_ProductCategory" />
            </div>
            <nwap:ValuedDropDownList Runat="server" CssClass="InputField MiddleWidthDDL" id="categoryValuedDropDownList" />
        </div>
        <div class="FormRow">
             <div class="LargerFieldNameRequireCharacter">
                <nwap:ResourceLabel runat="Server" CssClass="RedColor" ResourceFile="ControlPanelResources.xml" ResourceName="RequireCharacter" />
                <nwap:ResourceLabel runat="Server" ResourceFile="ControlPanelResources.xml" ResourceName="System_Applications_Yuanlin_Product_ApplicationCategory" />
            </div>
            <asp:CheckBoxList CssClass="CategoryCheckboxList" runat="server" RepeatDirection="Horizontal" RepeatColumns="4" ID="applicationCategoryCheckBoxList" />
        </div>
        <div class="FormRow">
            <nwap:ResourceLabel CssClass="FieldName" runat="Server" ResourceFile="ControlPanelResources.xml" ResourceName="System_Applications_Yuanlin_Product_LatinName" />
            <nwap:ValuedTextBox Runat="server" CssClass="InputField MiddleWidth" id="latinNameValuedTextBox" />
        </div>
        <div class="FormRow SubmitButtonRow">
            <nwap:Resourcebutton id="SaveButton" ResourceName="Save" CssClass="Button" Runat="server" OnClientClick="return CheckValue();"></nwap:Resourcebutton>&nbsp;&nbsp;&nbsp;&nbsp;
            <nwap:Resourcebutton id="BackButton" ResourceName="Back" CssClass="Button" Runat="server"></nwap:Resourcebutton>
        </div>
    </fieldset>
</div>
